開頭先上圖(?)
[ 0.907920] Run /sbin/init as init process
can't run '/etc/init.d/rcS': No such file or directory
Please press Enter to activate this console.
/ # mount -t proc proc /proc
/ # mount /disk_new.ext2 /sysroo[ 19.644547] random: fast init done
t
[ 20.796722] EXT4-fs (loop0): mounting ext2 file system using the ext4 subsystem
[ 20.802820] EXT4-fs (loop0): mounted filesystem without journal. Opts: (null)
/ # cd sysroot
/sysroot # pivot_root . .
/ # /sbin/apk --version
apk-tools 2.12.7, compiled for riscv32.
/ # /sbin/openrc --help
Usage: openrc [options] [<runlevel>]
Options: [ a:no:s:SChqVv ]
-n, --no-stop do not stop any services
-o, --override <arg> override the next runlevel to change into
when leaving single user or boot runlevels
-s, --service <arg> runs the service specified with the rest
of the arguments
-S, --sys output the RC system type, if any
-h, --help Display this help output
-C, --nocolor Disable color output
-V, --version Display software version
-v, --verbose Run verbosely
-q, --quiet Run quietly (repeat to suppress errors)
/ # /bin/busybox cat /etc/alpine-release
3.15.0_alpha20210804
/ # /bin/busybox cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.15.0_alpha20210804
PRETTY_NAME="Alpine Linux edge"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
/ # /bin/busybox cat /etc/motd
Welcome to Alpine!
The Alpine Wiki contains a large amount of how-to guides and general
information about administrating Alpine systems.
See <http://wiki.alpinelinux.org/>.
You can setup the system with the command: setup-alpine
You may change this message by editing /etc/motd.
重新打造一次基本上算突破困境了。但接下來迎接的挑戰是,如何徒手鍛造出符合Alpine正常開機流程的方式。
目前最直覺的方式,依舊是去查看ARMv7那邊的路:
$ qemu-system-arm -M virt -m 512M -cpu cortex-a15 -kernel vmlinuz-lts -initrd initramfs-lts \
-append "console=ttyAMA0 ip=dhcp alpine_repo=http://dl-cdn.alpinelinux.org/alpine/edge/main/" \
-nographic
簡單而言,Alpine在volatile的開機流程時,會主動透過去fetch bootarg給的alpine_repo
,來組出他真正的環境。但是這個對於我們現在在QEMU以及未來OrangeCrab的VexRiscv上,都還太遠了。
最暴力的方式是,先直接把apks塞進去cpio當中:
docker cp <imagehash>:/path/to/local/repo/main ./initramfs_extracted
pushd ./initramfs_extracted
find . | cpio -o -Hnewc |gzip -9 > ../image.cpio.gz
popd
qemu-system-riscv32 -M virt -bios /path/to/opensbi/fw_jump.elf -kernel /path/to/kernel/Image -initrd ./image.cpio.gz -append "debug_init ip=dhcp alpine_repo=/main"
但是目前這樣作,我遇到了Alpine Init的mdev在polling有哪些tty時發生無窮迴圈
nlplug-findfs: [71] reaped (0 running): /sbin/mdev: ACTION=add DEVPATH=/devices/virtual/tty/ptyc8 SUBSYSTEM=tty SYNTH_UUID=0 MAJOR=2 MINOR=216 DEVNAME=ptyc8 SEQNUM=1101
nlplug-findfs: [72] spawned (1 running): /sbin/mdev: ACTION=add DEVPATH=/devices/virtual/tty/ttyt8 SUBSYSTEM=tty SYNTH_UUID=0 MAJOR=3 MINOR=72 DEVNAME=ttyt8 SEQNUM=1102
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ttyp1' devpath='/devices/virtual/tty/ttyp1'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ttyvf' devpath='/devices/virtual/tty/ttyvf'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ptyx6' devpath='/devices/virtual/tty/ptyx6'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='tty3' devpath='/devices/virtual/tty/tty3'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ptyxd' devpath='/devices/virtual/tty/ptyxd'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ttyy6' devpath='/devices/virtual/tty/ttyy6'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ttyyd' devpath='/devices/virtual/tty/ttyyd'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ptyt8' devpath='/devices/virtual/tty/ptyt8'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='hvc1' devpath='/devices/virtual/tty/hvc1'
nlplug-findfs: uevent: action='add' subsystem='tty' devname='ptytf' devpath='/devices/virtual/tty/ptyt
尚待後續來看要怎麼跳過相關的流程。